<?php
/**
 * Created by 绵阳市碳素云信息技术有限责任公司.
 * User: castle
 * Date: 2015/05/15
 * Time: 9:11
 */

namespace Repair\Controller;

use Think\Controller;

class AccessoriesController extends Controller{
    function __construct(){
        parent::__construct();
    }
    function add($Name,$Model,$Number){
        $Model = D('Accessories');  //通过D方法实例化Accessories模型
        if(($ID = $Model->addAccessories($Name,$Model,$Number))){ //调用配件模型并添加数据，得到添加后的编号
            $this->json(array('AccessoriesID'=>$ID)); //如果添加成功返回给前端编号
        }else{
            $this->E('Error');//否则进入错误处理
        }
    }

    /**
     * @param int|array $AccessoriesID
     */
    function del($AccessoriesID){
        $Model = D('Accessories');
        if($Model->del($AccessoriesID)){
        }else{
            $this->E('Error');
        }
    }
}